% Script to run the saccade experiment

clear classes

Exp = ET_SACCADE();

% Screen size
%--------------------------------------------------------------------------
Exp.scn.w = 1680;
Exp.scn.h = 1050;
Exp.scn.wcm  = 47.7;
Exp.scn.hcb = 29.8;
Exp.scn.dist = 78;
Exp.scn.mon = 0;


%Exp.scn.w = 1920;
%Exp.scn.h = 1200;
%Exp.scn.wcm  = 52;
%Exp.scn.hcb = 32.5;
%Exp.scn.mon = 0;



% Creates an instance of the eye link manager
%--------------------------------------------------------------------------

Exp.el_pointer = EYELINK_EXP(Exp);

Exp.el_pointer.screen_phys_coords = [-Exp.scn.wcm/2,Exp.scn.hcm/2,Exp.scn.wcm/2,-Exp.scn.hcm/2];
Exp.el_pointer.screen_pixel_coords = [0,0,Exp.scn.w,Exp.scn.h];
Exp.el_pointer.screen_distance = [830,860];
% Configure manually the final ini file.


% Which blocks are displayed
%--------------------------------------------------------------------------

Exp.prepareBlocks([1 1 1 1]);
Exp.prepareTrials(24,[0,0,0,...
    0.25,0.45,0.65])

Exp.bc(1).bg = [0 78 0];
Exp.bc(3).bg = [0 78 0];

Exp.bc(1).tc = [185 0 0];
Exp.bc(3).tc = [185 0 0];

Exp.bc(1).fc = [185 0 0];
Exp.bc(3).fc = [185 0 0];

% Nine degrees of eccentricity
Exp.target.ecc = 9;

% Turn eye link on
%--------------------------------------------------------------------------
Exp.EyeLink = 0;
Exp.fix_win = 2*[-30,30,30,-30]; % left,up,right,down. Pixels

try 
    Exp.runScreen()
catch Err
    Exp.exit();
    rethrow(Err)
end
    
g = Exp.bh_r(:);
g(g == 37) = 0;
g(g == 39) = 1;
t = Exp.trials(:);
[g t]
